import React from 'react';
import { Link } from 'react-router-dom';
import { Menu, Icon } from 'antd';
// import Banner from './banner';
const SubMenu = Menu.SubMenu;

class Slider extends React.Component {
    
    render() {
        return (
            <div style={{width: 235}}>
                <div className="logo">
                    <Icon spin type="smile" style={{ fontSize: 40, color: '#6290FF'}}/>
                </div>
                <Menu
                    mode="inline"
                    defaultSelectedKeys={['1']}
                    >
                    {
                        this.props.data.map(function (menu, index) {
                            return  menu.children ? <SubMenu key={`sub${index+1}`} title={<span><Icon type="mail"/><span>{menu.name}</span></span>}>
                                        {
                                            menu.children.map(child => {
                                                return <Menu.Item key={child.id}>
                                                        <Link to={child.url}>
                                                            {child.name}
                                                        </Link>
                                                    </Menu.Item> 
                                            })
                                        }
                                    </SubMenu>  
                                    : <Menu.Item key={menu.id}>
                                        <Link to={menu.url}>
                                            {menu.name}
                                        </Link>
                                    </Menu.Item> 
                                
                        })
                    }
                    {/*<Menu.Item key="1">
                        <Link to="/">
                            <Icon type="user"/><span className="nav-text">首页</span>
                        </Link>
                    </Menu.Item>
                    <Menu.Item key="stuManage">
                        <Link to="/stuManage">
                            <Icon type="setting"/><span className="nav-text">学生管理</span>
                        </Link>
                    </Menu.Item>
                    <Menu.Item key="classManage">
                        <Link to="/classManage">
                            <Icon type="setting"/><span className="nav-text">班级管理</span>
                        </Link>
                    </Menu.Item>*/}
                </Menu>
            </div>
        );
    }
}

export default Slider;
